This repository was archived by the owner on May 21, 2026. It is now read-only.
Feat/add server tool - #9
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces dynamic server management by adding a new AddMCPServerTool to enable on‑the‑fly addition and connection of MCP servers, along with enhanced observability via a logState method in the ServerManager. Key changes include:
- Implementation of AddMCPServerTool for dynamic server addition and tool discovery.
- Enhancement of ServerManager with logState for detailed debugging and a corrected logger method.
- Updates to project examples and package.json to support the new server tool.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/managers/tools/add_server.ts | Adds the new tool to connect and add MCP servers dynamically. |
| src/managers/server_manager.ts | Includes logState improvements and corrected logger method usage. |
| package.json | Adds a new example command for the server tool. |
| examples/browser_use.ts | Minor cleanup of extraneous empty line. |
| examples/add_sever_tool.ts | Provides a usage example for dynamic server management. |
| .husky/pre-commit | Updated pre-commit hook command to use npm run lint. |
Comments suppressed due to low confidence (1)
examples/add_sever_tool.ts:1
- The filename 'add_sever_tool.ts' appears to have a typographical error. Consider renaming it to 'add_server_tool.ts' for clarity.
/**
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces a powerful new capability for the
MCPAgent: dynamic server management. The agent can now be equipped with a tool that allows it to add and connect to new MCP servers at runtime, based on the user's prompt. This significantly enhances the agent's autonomy and flexibility, as it can now dynamically expand its own toolset as required by the task at hand.The core of this change is the new
AddMCPServerTool, which is now provided and managed by theServerManager. When used, this tool:MCPClient.ServerManagerand sets the new server as the active one.The
ServerManagerhas been enhanced to be aware of the "active" server, and it now dynamically includes the active server's tools in the list it provides to the agent. This ensures that once a server is added, the agent immediately has access to its capabilities for the next step.Additionally, this PR includes several improvements:
logStatemethod was added to theServerManagerwhich, when the log level is set to 'debug', prints a detailed table of all configured servers, their connection status, tool count, and active status. This provides excellent visibility into the manager's state at each step of an agent's run.logger.warningtologger.warnand fixed an incorrect import path forzod.src/managers/tools/directory for better project structure.Type of change
Checklist